#include<stdio.h>
int bin_search(int arr[],int left,int right,int key)
{
	int mid=0;
	while(left<=right)
	{
		mid=(left+right)/2;
		if(arr[mid]<key)
		{
			left=mid+1;
		}
		else if(arr[mid]>key)
		{
			right=mid-1;
		}
		if(arr[mid]==key)
		{
			return mid;
			break;
		}
		else if(arr[mid]!=key&&left==right)
		{
			return -1;
			break;
		}
	}
}
int main()
{
	int n=0;
	scanf("%d",&n);
	int arr[n];
	int key;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&arr[i]);
	}
	scanf("%d",&key);
	printf("%d",bin_search(arr,0,n-1,key));
	
} 
